package Demo1.a01demo1;

import java.util.ArrayList;
import java.util.Scanner;

public class Test2 {
    public static void main(String[] args) {
        ArrayList<Integer> list = new ArrayList<>();
        Scanner sc = new Scanner(System.in);
        while (true) {
            String s = sc.nextLine();
            int num = Integer.parseInt(s);
            if (num < 1 || num > 100) {
                System.out.println("请输入1-100之间的数字");
                continue;
            }
            list.add(num);
            int sum = gwrSum(list);
            if (sum > 200) {
                break;
            }
        }
        for (int i = 0; i < list.size(); i++) {
            System.out.println(list.get(i));
        }
    }

    private static int gwrSum(ArrayList<Integer> list) {
        int sum = 0;
        for (int i = 0; i < list.size(); i++) {
            int number = list.get(i);
            sum += number;
        }
        return sum;
    }
}
